<!DOCTYPE html>

<html>
<head>
  <title>baseView.coffee</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
  <link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
  <div id="container">
    <div id="background"></div>
    
      <ul id="jump_to">
        <li>
          <a class="large" href="javascript:void(0);">Jump To &hellip;</a>
          <a class="small" href="javascript:void(0);">+</a>
          <div id="jump_wrapper">
          <div id="jump_page">
            
              
              <a class="source" href="app.html">
                app.coffee
              </a>
            
              
              <a class="source" href="appInstance.html">
                appInstance.coffee
              </a>
            
              
              <a class="source" href="appMessages.html">
                appMessages.coffee
              </a>
            
              
              <a class="source" href="appSettings.html">
                appSettings.coffee
              </a>
            
              
              <a class="source" href="baseList.html">
                baseList.coffee
              </a>
            
              
              <a class="source" href="baseModel.html">
                baseModel.coffee
              </a>
            
              
              <a class="source" href="countdown.html">
                countdown.coffee
              </a>
            
              
              <a class="source" href="countdownList.html">
                countdownList.coffee
              </a>
            
              
              <a class="source" href="eggTimer.html">
                eggTimer.coffee
              </a>
            
              
              <a class="source" href="scheduledTwitter.html">
                scheduledTwitter.coffee
              </a>
            
              
              <a class="source" href="aboutView.html">
                aboutView.coffee
              </a>
            
              
              <a class="source" href="baseView.html">
                baseView.coffee
              </a>
            
              
              <a class="source" href="countdownChristmasView.html">
                countdownChristmasView.coffee
              </a>
            
              
              <a class="source" href="countdownView.html">
                countdownView.coffee
              </a>
            
              
              <a class="source" href="eggTimerView.html">
                eggTimerView.coffee
              </a>
            
              
              <a class="source" href="indexView.html">
                indexView.coffee
              </a>
            
              
              <a class="source" href="statsView.html">
                statsView.coffee
              </a>
            
          </div>
        </li>
      </ul>
    
    <ul class="sections">
        
          <li id="title">
              <div class="annotation">
                  <h1>baseView.coffee</h1>
              </div>
          </li>
        
        
        
        <li id="section-1">
            <div class="annotation">
              
              <div class="pilwrap for-h2">
                <a class="pilcrow" href="#section-1">&#182;</a>
              </div>
              <h2>BASE VIEW</h2>

            </div>
            
        </li>
        
        
        <li id="section-2">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-2">&#182;</a>
              </div>
              <p>This serves as the base for all app views.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">BaseView</span></span>

    id: <span class="literal">null</span>
    dom: {}</pre></div></div>
            
        </li>
        
        
        <li id="section-3">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-3">&#182;</a>
              </div>
              <p>Set the DOM elements.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    setDom: (arr) =&gt;
        <span class="property">@addDomElement</span> selector <span class="keyword">for</span> selector <span class="keyword">in</span> arr</pre></div></div>
            
        </li>
        
        
        <li id="section-4">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-4">&#182;</a>
              </div>
              <p>Add a reference to an element based on the selector.
First character selectors (dot and hash) will be replaced.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    addDomElement: (selector) =&gt;
        firstChar = selector.substring <span class="number">0</span>, <span class="number">1</span>
        domId = selector.substring(<span class="number">1</span>) <span class="keyword">if</span> firstChar <span class="keyword">is</span> <span class="string">"#"</span> <span class="keyword">or</span> firstChar <span class="keyword">is</span> <span class="string">"."</span>
        domId = domId.replace RegExp(<span class="string">" "</span>, <span class="string">"g"</span>), <span class="string">""</span>
        domId = domId.replace RegExp(<span class="string">"&gt;"</span>, <span class="string">"g"</span>), <span class="string">"_"</span>
        <span class="property">@dom</span>[domId] = $ selector</pre></div></div>
            
        </li>
        
        
        <li id="section-5">
            <div class="annotation">
              
              <div class="pilwrap for-h2">
                <a class="pilcrow" href="#section-5">&#182;</a>
              </div>
              <h2>VISUAL ALERTS</h2>

            </div>
            
        </li>
        
        
        <li id="section-6">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-6">&#182;</a>
              </div>
              <p>Display an alert with a title and message to the user.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    showAlert: (title, message) =&gt;
        alert message</pre></div></div>
            
        </li>
        
        
        <li id="section-7">
            <div class="annotation">
              
              <div class="pilwrap for-h2">
                <a class="pilcrow" href="#section-7">&#182;</a>
              </div>
              <h2>HELPER METHODS</h2>

            </div>
            
        </li>
        
        
        <li id="section-8">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-8">&#182;</a>
              </div>
              <p>Warn the user about an empty or invalid field, by blinking with a red background.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    warnField: (field) =&gt;
        field.addClass <span class="string">"warn"</span>
        callback = () -&gt; field.removeClass <span class="string">"warn"</span>
        setTimeout callback, App.Settings.UI.fieldWarnDelay</pre></div></div>
            
        </li>
        
        
        <li id="section-9">
            <div class="annotation">
              
              <div class="pilwrap for-h2">
                <a class="pilcrow" href="#section-9">&#182;</a>
              </div>
              <h2>APPEND VIEW TO WINDOW</h2>

            </div>
            
        </li>
        
        
        <li id="section-10">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-10">&#182;</a>
              </div>
              
            </div>
            
            <div class="content"><div class='highlight'><pre>window.App.BaseView = BaseView</pre></div></div>
            
        </li>
        
    </ul>
  </div>
</body>
</html>
